import { ref } from 'vue'

export const useLoading = () => {
    const globalLoading = ref(false)

    const showLoading = (title = '加载中...') => {
        globalLoading.value = true
        uni.showLoading({
            title,
            mask: true
        })
    }

    const hideLoading = () => {
        globalLoading.value = false
        uni.hideLoading()
    }

    return {
        globalLoading,
        showLoading,
        hideLoading
    }
} 